package com.sunny.ynhz.ui.report;

import android.content.Intent;
import android.os.Bundle;
import android.support.design.widget.BottomSheetDialog;
import android.support.design.widget.TabLayout;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.AdapterView;
import android.widget.EditText;
import android.widget.ListView;

import com.sunny.ynhz.R;
import com.sunny.ynhz.adapter.CurrentRiverAdapter;
import com.sunny.ynhz.bean.CurrentRiverBean;
import com.sunny.ynhz.bean.WarpRiverBean;
import com.sunny.ynhz.model.RiverMsgModel;
import com.sunny.ynhz.ui.base.AppBaseTranslationTitleBarActivity;
import com.sunny.ynhz.utils.BottomSheetListView;
import com.sunny.ynhz.utils.ShowUtils;
import com.sunny.ynhz.utils.SwitchFragmentUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

import static com.sunny.ynhz.utils.ApplicationUtils.getContext;

/**
 * Created by huhuan123 on 2018/9/5.
 *
 * @describe TODO
 */

public class ChooseSubmitForObjectActivityNative extends AppBaseTranslationTitleBarActivity {
    @BindView(R.id.tab_title)
    TabLayout tabLayout;
    private RiverChiefFragment riverChiefFragment;
    private RiverDutyFragment riverDutyFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_choose_submit_object);
        setTitle("选择对象");
        riverChiefFragment = RiverChiefFragment.getRiverChiefFragment();
        riverDutyFragment = RiverDutyFragment.getRiverDutyFragment();
        SwitchFragmentUtils switchFragmentUtils = new SwitchFragmentUtils(getContext(), getSupportFragmentManager());
        switchFragmentUtils.swithFragment(riverChiefFragment);
        tabLayout.addTab(tabLayout.newTab().setText("河长"));
        tabLayout.addTab(tabLayout.newTab().setText("职能部门"));
        tabLayout.setOnTabSelectedListener(new TabLayout.OnTabSelectedListener() {
            @Override
            public void onTabSelected(TabLayout.Tab tab) {
                if (tab.getText().toString().equals("河长")) {
                    switchFragmentUtils.swithFragment(riverChiefFragment);
                } else {
                    switchFragmentUtils.swithFragment(riverDutyFragment);
                }
            }

            @Override
            public void onTabUnselected(TabLayout.Tab tab) {

            }

            @Override
            public void onTabReselected(TabLayout.Tab tab) {

            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        riverChiefFragment.onActivityResult(requestCode, resultCode, data);

    }
}
